﻿//======================================================================
//
//        Copyright (C) 2008 HOHO``
//        All rights reserved
//
//        filename :$safeitemrootname$
//        description :作业中心路径控件。
//
//        created by 裘中杰 at  $time$
//======================================================================



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hisun.Controllers;

namespace Hisun.UserControl.CostCenter
{
    public partial class CostCenterPathFrameworkDetail : System.Web.UI.UserControl
    {
        private List<int> costCenterIDs;
        private int costCenterID;

        public int CostCenterID
        {
            get { return costCenterID; }
            set { costCenterID = value; }
        }

        public List<int> CostCenterIDs
        {
            private get { return costCenterIDs; }
            set { costCenterIDs = value; }
        }

        public int GetCostDriverSelected
        {
            get
            {
                return Convert.ToInt32(dropCostDriver.SelectedValue);
            }
        }

        public string SetCostDriverSelectedByValue
        {
            set
            {
                dropCostDriver.Items.FindByValue(value).Selected = true;
            }
        }

        public TreeNodeCollection GetCheckedNodes
        {
            get
            {
                return TreeView1.CheckedNodes;
            }
        }

        public void GetTree(int costCenterID)
        {
            this.costCenterID = costCenterID;
            GetTree();
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void GetTree()
        {
            AbcCostCenterFramework ccf = new AbcCostCenterFramework();
            ccf.CostCenterIDs = costCenterIDs;
            ccf.InitPathCostCenterIDsByCostCenterID(costCenterID);
            TreeView1.Nodes.Clear();
            TreeView1.Nodes.Add(ccf.GetListMenu(false));
            TreeView1.ExpandDepth = 3;
            TreeView1.ExpandAll();
        }


    }
}